package os.kernelProcess;

import os.MiniOS;
import os.MiniProcess;
import os.MiniThread;

/**
 * Thread to monitor processes in the system. It belongs to the Kernel process.
 * 
 * @author Ahmed El-Eryan
 * 
 */
public class ProcessMonitorThread extends MiniThread
{

	/**
	 * Constructor to the ProcessMonitorThread.
	 * 
	 * @param process
	 *            KernelProcess
	 * @param tid
	 *            ID of the process monitor thread.
	 */
	public ProcessMonitorThread(MiniProcess process, String tid)
	{
		super(process, tid);
		description = "Process Monitor Thread";
	}

	/**
	 * Just updates the process list and stops, then waits for the next quantum
	 * to do the same.
	 */
	@Override
	public void run()
	{
		while (true)
		{
			MiniOS.getInstance().getView().refreshProcessesList();
//			stopExecution();
//			MiniOS.getInstance().threadStopped();
//			isExcecutionStopped();
			try 
			{
				Thread.sleep(3000);
			} 
			catch (InterruptedException e) 
			{
				e.printStackTrace( );
			}
		}
	}

	/**
	 * Doesn't need console arguments.
	 */
	@Override
	public void passThreadArguments(Object[] arguments)
	{
	}

}
